nth term of a quadratic sequence